<?php

namespace App\Http\Requests\Goods;

use Illuminate\Foundation\Http\FormRequest;

class Goodsrequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

     /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
        public function rules()
        {
            return [
                'gname' => 'required',
                'goods_sn' => 'required',
                'bid' => 'required',
                'sid' => 'required',
                'price' => 'required',
                'unit' => 'required',
                'click' => 'required',
                'state' => 'required',
                'is_member_price' => 'required',
                'score' => 'required',
                'color' => 'required',
                'size' => 'required',
                'price' => 'required',
                // 'discount_price' => 'required',
                'sales' => 'required',
                'is_discount' => 'required',
            ];

        }

        public function  messages()
        {
            return [
                'gname.required' => '名称不能为空',
                'goods_sn.required' => '货号不能为空',
                'bid.required' => '品牌不能为空',
                'sid.required' => '类别不能为空',
                'price.required' => '原价不能为空',
                'unit.required' => '属性不能为空',
                'click.required' => '点击不能为空',
                'state.required' => '状态不能为空',
                'is_member_price.required' => '会员价不能为空',
                'score.required' => '积分不能为空',
                'color.required' => '颜色不能为空',
                'size.required' => '尺寸不能为空',
                'price.required' => '价格不能为空',
                // 'discount_price.required' => '促销价不能为空',
                'sales.required' => '销量不能为空',
                'is_discount.required' => '是否促销不能为空',
            ];
        }
}
